#ifndef _URI_HANDLER_H
#define _URI_HANDLER_H

#include <string.h>
#include "mongoose.h"

typedef int (*uri_handler) (struct mg_connection *conn,
		const struct mg_request_info *ri,
		const char *uri,
		int mobile);

struct dyn_req_handlers {
	/* request types */
#define REQ_UNK -1
#define REQ_QUE  0
#define REQ_ADD  1
#define REQ_DEL  2
	int type;

	char *uri;
	uri_handler handler;
};

#define JSON_REPLY_START "HTTP/1.1 200 OK\r\n" \
	"Cache: no-cache\r\n" \
	"Content-Type: application/json; charset=utf-8\r\n" \
	"\r\n\r\n"

#define JSON_START() do { \
	mg_write(conn, JSON_REPLY_START, strlen(JSON_REPLY_START)); \
} while (0);

#endif
